//
//  WYTCalendarView.m
//  Diary
//
//  Created by 王艺拓 on 15/11/11.
//  Copyright © 2015年 王艺拓. All rights reserved.
//

#import "WYTCalendarView.h"
#import "WYTTimeTool.h"
#import "WYTDevicesTool.h"

@interface WYTCalendarView ()

@end

@implementation WYTCalendarView

- (instancetype)init{
    self = [super init];
    if (self) {
        [self setUps];
    }
    return self;
}

- (void)setUps{
    [self setUpScenes];
}

- (void)setUpScenes{
    
    CGFloat timeLabelY = kScreenWidth * 0.543 * 0.3;
    if ([WYTDevicesTool iPhone4_iPhone4s]) {
        timeLabelY = kScreenWidth * 0.543 * 0.25;
    }
    self.timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, timeLabelY, kScreenWidth * 0.543, kScreenWidth * 0.543 * 0.18)];
    self.timeLabel.text = [NSString stringWithFormat:@"%@.%@ %@", [WYTTimeTool currentYear], [WYTTimeTool currentMonth], [WYTTimeTool currentDay]];
    NSInteger timeLabelFontSize = 20;
    self.timeLabel.font = [UIFont boldSystemFontOfSize:timeLabelFontSize];
    self.timeLabel.textColor = [UIColor grayColor];
    self.timeLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.timeLabel];
    
//    CGFloat lineViewWidth = CGRectGetWidth(self.timeLabel.frame) * 0.6;
//    UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake((CGRectGetWidth(self.timeLabel.frame) - lineViewWidth) / 2, CGRectGetMaxY(self.timeLabel.frame), lineViewWidth, 2)];
//    lineView.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:0.5f];
//    [self addSubview:lineView];
    
    CGFloat dateLabelY = kScreenWidth * 0.543 * 0.43;
    if ([WYTDevicesTool iPhone4_iPhone4s]) {
        dateLabelY = kScreenWidth * 0.543 * 0.38;
    }
    self.dateLabel = [[UILabel alloc]initWithFrame:CGRectMake((kScreenWidth * 0.543 - kScreenWidth * 0.543 / 3 * 1.5) / 2, dateLabelY, kScreenWidth * 0.543 / 3 * 1.5, kScreenWidth * 0.543 / 3 * 1.5)];
    self.dateLabel.text = [WYTTimeTool currentDate];
    self.dateLabel.textColor = [UIColor grayColor];
    NSInteger dateLabelFontSize = 100;
    if ([WYTDevicesTool iPhone6_iPhone6s]) {
        dateLabelFontSize = 90;
    }else if ([WYTDevicesTool iPhone320_DEVICES]){
        dateLabelFontSize = 70;
    }
    self.dateLabel.font = [UIFont boldSystemFontOfSize:dateLabelFontSize];
    self.dateLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.dateLabel];
}

@end
